﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MSRoboticsFramework.HCIDeviceLayer.Wii;
using WheeledTank.LogicLayer;

namespace WheeledTank.HCIDeviceLayer.Wii
{
    public class WiiInputInterpreter : IWiiInputInterpreter
    {
        WheeledTankModel Tank;

        public WiiInputInterpreter(WheeledTankModel Tank)
        {
            this.Tank = Tank;
        }

        #region IWiiInputInterpreter Members

        public void YAxisChanged(float value)
        {
            Tank.SteeringAngle = value;
        }

        public void XAxisChanged(float value)
        {
            Tank.Speed = value;
        }

        public void ZAxisChanged(float value)
        {
            ///not used...
        }

        public void ButtonUpChanged(bool pressed)
        {
            if (pressed)
                Tank.TurnTurretUp();
            else
                Tank.StopVerticalTurningOfTurret();
        }

        public void ButtonDownChanged(bool pressed)
        {
            if (pressed)
                Tank.TurnTurretDown();
            else
                Tank.StopVerticalTurningOfTurret();
        }

        public void ButtonLeftChanged(bool pressed)
        {
            if (pressed)
                Tank.TurnTurretLeft();
            else
                Tank.StopHorizontalTurningOfTurret();
        }

        public void ButtonRightChanged(bool pressed)
        {
            if (pressed)
                Tank.TurnTurretRight();
            else
                Tank.StopHorizontalTurningOfTurret();
        }

        public void ButtonOneChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonTwoChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonAChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonBChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonPlusChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonMinusChanged(bool pressed)
        {
            ///not used...
        }

        public void ButtonHomeChanged(bool pressed)
        {
            ///not used...
        }

        #endregion
    }
}
